package de.openkanban.client.ui.presenter;

import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;

import de.openkanban.client.util.RootPanel;
import de.openkanban.shared.dto.BoardDto;

/**
 * Callback that handles get board by id request
 */
public class GetBoardByIdRequestCallback implements RequestCallback {

	@Override
	public void onError(Request request, Throwable exception) {

	}

	@Override
	public void onResponseReceived(Request request, Response response) {
		BoardDto boardDto = new BoardDto(response.getText());
		RootPanel.main.getBoard().getCurrentBoardNameLabel().setContents(boardDto.getBoardName());
		RootPanel.main.getBoard().getWhiteBoardView().loadActivities(boardDto);
	}
}
